<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <%@ include file="/common/plateform/include/common-base.jsp"%>
  <title>动态表单-表单设计器</title>
</head>
<body class="hold-transition ${sysColor} sidebar-mini">
<div class="wrapper">

  <!-- top start -->
  <%@include file="/common/plateform/top.jsp" %>
  <!-- top end -->
  
  <!-- left start -->
  <%@include file="/common/plateform/left.jsp" %>
  <!-- left end-->

  <!-- Main start -->
  <div class="content-wrapper">
    <!-- Main start -->
	<section class="content">
      <div class="row">
        <div class="col-xs-12 ibox">
        
          <!--搜索  start -->
          <div class="box box-info collapsed-box">
          
             <!--搜索title  start --> 
	          <div class="box-header with-border">
                 <h3 class="box-title"><i class="fa fa-search"></i> 搜索</h3>
                 <div class="box-tools pull-right">
	                <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-plus"></i></button>
	                <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
                 </div>
              </div>
              
            <!--搜索title  end --> 
            <div class="box-body">
			  <form id="searchForm" class="form-horizontal">
				<input type="hidden" name="modelTypes" value="s_sortInfo"/>
				<input type="hidden" name="orderBy" value="table_prefix"/>
				<div class="form-group">
					<div class="col-sm-2 text-right"><label class="control-label">前缀：</label></div>
					<div class="col-sm-4">
						 <input type="text" class="form-control clean"  name="sortInfo.wl_tablePrefix" value=""/>
					</div>
					<div class="col-sm-2 text-right"><label class="control-label">编号：</label></div>
					<div class="col-sm-4">
						 <input type="text" class="form-control clean"  name="sortInfo.wl_sortCode" value=""/>
					</div>
				 </div>
				 <div class="form-group">
					<div class="col-sm-2 text-right"><label class="control-label">表名：</label></div>
					<div class="col-sm-4">
						 <input type="text" class="form-control clean"  name="sortInfo.wl_infoTableName" value=""/>
					</div>
					<div class="col-sm-2 text-right"><label class="control-label">对象：</label></div>
					<div class="col-sm-4">
						 <input type="text" class="form-control clean"  name="sortInfo.wl_objName" value=""/>
					</div>
				 </div>
				
				 <div class="form-group">
					<div class="col-sm-2 text-right"><label class="control-label">所属系统：</label></div>
					<div class="col-sm-4">
							<select id="searchForm_sysName"
								name="sortInfo.w_sysName" class="form-control  clean"
								data-temp-obj="sysName"
								data-dict-code="dymicSql" data-dict-cate="s_uctSys"
								data-colmun="{value:'sysEname',text:'sysCname',other:''}"
								data-type-tag="select" data-def=""><option
									value="">--请选择--</option>
							</select>					
					</div>
					<div class="col-sm-2 text-right"><label class="control-label">状态：</label></div>
					<div class="col-sm-4">
						<select id="searchForm_sortStatus"
							name="sortInfo.w_sortStatus" class="form-control  clean"
							data-temp-obj="sortStatus"
							data-dict-code="dictItemList" data-dict-cate="tableStatus"
							data-colmun="" data-condition="" data-type-tag="select"
							data-def="" data-name="sortStatus"><option
								value="">--请选择--</option>
						</select>
					</div>
				</div>
				
				<center>
				  <div class="box-footer clearfix">
				       <button type="button" class="btn btn-success" onclick="getTableData();"><i class="fa fa-search"></i> 查询</button>&nbsp;
				       <button type="button" class="btn btn-warning" onclick="cleanData('searchForm');">重置 </button>
				   </div>
				</center>
			  </form>
			  <c:if test="${'1'==loginUser.sysFlag }">
				<center>
				<form id="databaseForm" >
				   <div class="box-footer clearfix">
				   <div class="col-sm-2 text_r"><label class="control-label" > 数据库：</label></div>
				   <div class="col-sm-3">
				       <select name="databaseType" id="databaseType" class="form-control clean"> 
				           <option>--请选择--</option>
				           <option value="oracle">oracle</option>
				           <option value="mysql">mysql</option>
				           <option value="sqlserver">sqlserver</option>
				        </select>
					</div>
					<div class="col-sm-2">
				       	<button type="button" class="btn btn-success" onclick="createSql()">生成sql</button>&nbsp;
				       	</div>
				   </div>
				   </form>
				</center>
				</c:if>
            </div>
	     </div>
	     <!-- 搜索 end -->
        
        <div class="box box-success">
            <!--列表title  start --> 
	        <div class="box-header with-border">
                 <h3 class="box-title"><i class="fa fa-table"></i> 数据表管理
                 　　　              <!--  <br/><br/>
                    <div role="toolbar" class="btn-toolbar">
				     <div class="btn-group">-->
				        <button aria-label="Left Align" class="btn btn-success" type="button" onclick="toAdd();"><span aria-hidden="true" class="glyphicon glyphicon-plus"></span> 增加新表 </button>
			          <!--</div>
					</div>-->
                 </h3>
                 <div class="box-tools pull-right">
	                 　　　　　　　　<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
	                </button>
	                <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
                 </div>
            </div>
            
            <!-- /.box-header -->
            <div class="box-body">
              <table id="dataList" class="table table-bordered table-hover" >
                <thead class="bg-success">
                <tr>
                  <th>表名前缀</th>
                  <th>分类编号</th>
                  <th>分类名称</th>
                  <th>表名称</th>
                  <th>对象别名</th>
                  <th>所属系统</th>
                  <th>状态</th>
                  <th>操作</th>
                </tr>
                </thead>
                <tbody id="dataList-body">
                </tbody>
              </table>
              <center>
    	  		<ul id="dataList-page"></ul>
              </center>
            </div>
            
          </div>
        </div>
      </div>
    </section>
    <!-- Main end -->
    
    
 <div class="modal fade" id="my_modal_add" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog" >
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
							&times;
						</button>
						<h4 class="modal-title">
							<font color="red">添加</font>&nbsp;
						</h4>
					</div>
					<div class="modal-body">
				
					   <form class="form-horizontal" role="form" id="addForm">
					   		
					   		<!-- 隐藏域 start -->
							<input type="hidden" name="formToken" id="formToken" value=""/>
							<input type="hidden" name="sortStatus" id="sortStatus" value="0"/>
							<input type="hidden" name="infoTableName" id="infoTableName" value=""/>
					     	<input type="hidden" name="sortDisable" value="0" />
			                <input type="hidden" name="sortStatistics" value="0" />
					         <!-- 隐藏域 end -->
					         
					        <div class="box-body" id="submitFormData">
					        
					          	<!-- 属性循环体 start -->
					          	
					          	<div class="form-group">
				                  <label class="col-sm-3 control-label" >所属系统：</label>
				                  <div class="col-sm-8">
										<select id="addForm_sysName"
											name="sysName" class="form-control  clean"
											data-temp-obj="sysName"
											data-dict-code="dymicSql" data-dict-cate="s_uctSys"
											data-colmun="{value:'sysEname',text:'sysCname',other:''}"
											data-type-tag="select" data-def=""><option
												value="">--请选择--</option>
										</select>				                  
								  </div>
				                </div>
								<div class="form-group">
									<label class="col-sm-3 control-label" >数据库类型：</label>
									<div class="col-sm-8">
										<select name="databaseType"  class="form-control">
											<option>--请选择--</option>
											<option value="oracle" <c:if test="${database_type=='oracle'}">selected</c:if>>oracle</option>
											<option value="mysql"  <c:if test="${database_type=='mysql'}">selected</c:if>  >mysql</option>
										</select>
									</div>
								</div>

					          	<div class="form-group">
				                  <label class="col-sm-3 control-label" >表名前缀：</label>
				                  <div class="col-sm-8">
				                     <input type="text" id="tablePrefix"  name="tablePrefix" class="form-control clean" placeholder="表的英文前缀标识，只能填写字母！" onchange="setInfoTableName('addForm')" />
				                  </div>
				                </div>
					          	
				                <div class="form-group">
				                  <label class="col-sm-3 control-label" >分类编号：</label>
				                  <div class="col-sm-8">
				                    <input type="text" id="sortCode"  name="sortCode" class="form-control clean" maxlength="80" placeholder="数据表的英文名，多个单词使用下划线间隔！" onchange="setInfoTableName('addForm')"/>
				                  </div>
				                </div>
				                
				                
				                
				                <div class="form-group">
				                  <label class="col-sm-3 control-label" >分类名称：</label>
				                  <div class="col-sm-8">
				                   	<input type="text" id="sortName"  name="sortName" class="form-control clean" placeholder="请输入数据表的中文名！"/>
				                  </div>
				                </div>
				                <div class="form-group">
				                  <label class="col-sm-3 control-label" >对象别名：</label>
				                  <div class="col-sm-8">
				                   	<input type="text" id="objName"  name="objName" class="form-control clean" placeholder="请填写英文数据表名-驼峰式！"/>
				                  </div>
				                </div>
			             
				                  	
				                <div class="form-group">
				                  <label class="col-sm-3 control-label" >是否为主表：</label>
				                  <div class="col-sm-8">
				                    <div class="mt5">
				                      <input type="radio" name="mainTab" value="1" checked="checked">是
				                      <input type="radio" name="mainTab" value="0" >否
				                    </div>
				                  </div>
				                </div>
				                <!-- 属性循环体 end -->
					        </div>
					        
			                <div class="box-footer">
				                <button type="button" class="btn btn-success pull-left" onclick="cannel('');">取消</button>
				                <button type="button" class="btn btn-danger pull-right" onclick="add('addForm');">提 交</button>
				            </div>
				            
						</form>
					</div>
				</div>
				<!-- /.modal-content -->
	</div>		
</div>   
    
    
 <div class="modal fade" id="my_modal_edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog" >
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
							&times;
						</button>
						<h4 class="modal-title">
							<font color="red">修改</font>&nbsp;
						</h4>
					</div>
					<div class="modal-body">
				
					   <form class="form-horizontal" role="form" id="editForm">
					   		
					   		<!-- 隐藏域 start -->
							<input type="hidden" name="formToken" id="formToken" value=""/>
						    <input type="hidden" id="w_sortId" name="sortId" value=""/>
					         <!-- 隐藏域 end -->
					         
					        <div class="box-body" id="submitFormData">
					        
					          	<!-- 属性循环体 start -->
					          	
					          	<div class="form-group">
				                  <label class="col-sm-3 control-label" >所属系统：</label>
				                  <div class="col-sm-8">
										<select id="sysName"
											name="sysName" data-name="sysName" class="form-control  clean"
											data-temp-obj="sysName"
											data-dict-code="dymicSql" data-dict-cate="s_uctSys"
											data-colmun="{value:'sysEname',text:'sysCname',other:''}" 
											data-type-tag="select" data-def=""><option
												value="">--请选择--</option>
										</select>				                  
								  </div>
				                </div>
								<div class="form-group">
									<label class="col-sm-3 control-label" >数据库类型：</label>
									<div class="col-sm-8">
										<select name="databaseType"  class="form-control">
											<option>--请选择--</option>
											<option value="oracle" <c:if test="${database_type=='oracle'}">selected</c:if> >oracle</option>
											<option value="mysql"  <c:if test="${database_type=='mysql'}">selected</c:if>  >mysql</option>
										</select>
									</div>
								</div>
					          	<div class="form-group">
				                  <label class="col-sm-3 control-label" >表名前缀：</label>
				                  <div class="col-sm-8">
				                     <input type="text" id="tablePrefix"  name="tablePrefix" class="form-control clean" onchange="setInfoTableName('editForm')" />
				                  </div>
				                </div>
					          	
				                <div class="form-group">
				                  <label class="col-sm-3 control-label" >分类编号：</label>
				                  <div class="col-sm-8">
				                    <input type="text" id="sortCode"  name="sortCode" class="form-control clean" maxlength="50" placeholder="必填项" onchange="setInfoTableName('editForm')"/>
				                  </div>
				                </div>
				                
				           
				                
				                <div class="form-group">
				                  <label class="col-sm-3 control-label" >分类名称：</label>
				                  <div class="col-sm-8">
				                   	<input type="text" id="sortName"  name="sortName" class="form-control clean" />
				                  </div>
				                </div>
				                <div class="form-group">
				                  <label class="col-sm-3 control-label" >对象别名：</label>
				                  <div class="col-sm-8">
				                   	<input type="text" id="objName"  name="objName" class="form-control clean"/>
				                  </div>
				                </div>
			             
				                  	
				                <div class="form-group">
				                  <label class="col-sm-3 control-label" >是否为主表：</label>
				                  <div class="col-sm-8">
				                    <input type="radio" name="mainTab" value="1" checked="checked">是
				                    <input type="radio" name="mainTab" value="0" >否
				                  </div>
				                </div>
				                
				                
				                <!-- 属性循环体 end -->
				                
					        </div>
					        
			                <div class="box-footer">
				                <button type="button" class="btn btn-success pull-left" onclick="cannel('edit');">取消</button>
				                <button type="button" class="btn btn-danger pull-right" onclick="add('editForm');">提 交</button>
				            </div>
				            
						</form>
					</div>
				</div>
				<!-- /.modal-content -->
			</div>		
</div>   
    
<div class="modal fade" id="my_modal_sql" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog" >
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
						<h4 class="modal-title"><font color="red">sql脚本</font>&nbsp;</h4>
					</div>
					<div class="modal-body" id="dataBase_sql"></div>
				</div>
				<!-- /.modal-content -->
		</div>		
</div>    
    
 <script type="text/template" id="dataList-template">
		<? for ( var i = 0; i < rows.length; i++) {?>
			<tr>
				<th style="display:none;"><?=rows[i].sortId?></th>
				<td><?=(pageObj.currentPage-1)*10+(i+1)?>.<?=strUtil.doNull(rows[i].tablePrefix,'')?></td>
				<td><?=strUtil.doNull(rows[i].sortCode,'')?></td>
				<td><?=strUtil.doNull(rows[i].sortName,'')?></td>
				<td><?=strUtil.doNull(rows[i].infoTableName,'')?></td>
				<td><?=strUtil.doNull(rows[i].objName,'')?></td>
				<td><?=dictListMap["s_uctSys"][strUtil.doNull(rows[i].sysName,'')]?></td>
				<td>
					<?=dictListMap["tableStatus"][rows[i].sortStatus]?>
				</td>
				<td>
				<?if('sort_info'!=rows[i].sortCode){?>
					<?if(rows[i].sortStatus=="1"){?>
						<button type="button" class="btn btn-danger btn-xs" onclick="startOrStop('<?=rows[i].sortId?>','stop')">停用</button>&nbsp;&nbsp;
					<?}else{?>
						<button type="button" class="btn btn-success btn-xs" onclick="startOrStop('<?=rows[i].sortId?>','start')">启用</button>&nbsp;&nbsp;
						<button type="button" class="btn btn-danger btn-xs" onclick="toDele('<?=rows[i].sortId?>','<?=rows[i].infoTableName?>');"><span aria-hidden="true" class="fa fa-remove"></span> 删除</button>&nbsp;&nbsp;
					<?}?>
						<button class="btn btn-warning btn-xs"  type="button" onclick="toLoad('<?=rows[i].sortId?>','edit');"><span aria-hidden="true" class="fa fa-pencil-square-o"></span> 修改</button>&nbsp;&nbsp;
						<button type="button" class="btn btn-success btn-xs" onclick="toCreate('<?=rows[i].infoTableName?>','<?=rows[i].sortCode?>','<?=rows[i].sysName?>')">字段设计</button>
				<?}?>
				</td>
			</tr>
		<?}?>
</script>

<script>
var clickMenu = "objName-table";
var id,myPage,dataListId,searchFormId,isShowLog,objName,objId;
myPage = 10;
dataListId = "dataList";
searchFormId = "searchForm";
objName = "pubMetadata";
objId = "infoId";
isShowLog = true;
var id;

/**
 * 初始化数据字典，id传入#id 返回值Map用法：dictListMap["userType"][rows[i].userType]
 */
var dictListMap = DictUtil.initDictAndDymic();
$(function () {
	//1、加载分页列表数据
	getTableData();
	//2、控制是否启用token
	//setToken();
	id = $('tr.selected th').eq(0).html();
	//请在下面补充其他初始化方法（如数据字典、页面加载数据等）
	//DictUtil.getDictExtList("#proUnit", dictUrl, {cateEname:"productUnit"});
	//DictUtil.getDataToSelect("#selectCate",{modelTypes:"s_trpCate"},{value:"cateId",text:"cateName",other:"cateNo,cateType"});
	
 });


//读取（查询、编辑）数据
function toLoad(pid,type){
	if(pid!=null && pid!=""){
		id = pid;
	}
	var paramLoadData = {"sortInfo.w_sortId":id,"modelTypes":"s_sortInfo"};
	loadObj(type,paramLoadData);
}
//逻辑删除
function toDele(id,tableName){
	var index_submit = layer.confirm("<font color=\"red\"><i class=\"fa fa-warning\"></i> 严重警告！删除不可恢复！</font><br/>您确定要删除【"+tableName+"】表吗？", {btn: ['Yes','No'],closeBtn: 0,offset: '220px'}
	, function(){
		layer.close(index_submit);
		var paramLoadData = {"sortId":id};
		doDele(paramLoadData);
	});
}
//反显数据
function showData(type,myData){
	console.log(myData);
	if("view"==type){
		FormUtil.loadView("", myData);
		$("#my_modal_view").modal("show");
	}else if("edit"==type){
		FormUtil.fillData("#editForm", myData,"id");
		$("#w_sortId").val(myData.sortId);
		setValidate("#editForm");//初始化表单验证属性
		$("#my_modal_edit").modal("show");
	}
}

function toCreate(tableName,sortCode,sysName){
	if(tableName && sortCode){
		var url ="${page_admin}/sort/objName-table-column?tableName="+tableName+"&sortCode="+sortCode+"&sysName="+sysName+"&page="+pageObj.currentPage;
		mytools.pjax(url);
	}
}

function setInfoTableName(formId){
	
	var sysCode = $("#"+formId+" #tablePrefix").val();
	var sortCode = $("#"+formId+" #sortCode").val();
	var tableName = sysCode+"_"+sortCode;
	$("#"+formId+" #infoTableName").val(tableName);
	$("#"+formId+" #objName").val(sysCode+tranformStr1(sortCode));
}
//字符串转成驼峰的方法
function transformStr3(str){
    var re=/_(\w)/g;
    return str.replace(re,function ($0,$1){
        return $1.toUpperCase();
    });
}

//首字母大写
function tranformStr1(str){
    var strArr=transformStr3(str);
    strArr=strArr.charAt(0).toUpperCase()+strArr.substring(1);
    return strArr;
}


$(function () {
	$('#'+dataListId+' tbody').on('click','tr', function (e) {
	     if ( $(this).hasClass('selected') ) {
	            //$(this).removeClass('selected');
	        }
	        else {
	            $('tr.selected').removeClass('selected');
	            $(this).addClass('selected');
	        }
	     id = $('tr.selected td').eq(0).html();
	   //  console.log($('tr.selected td').eq(1).html())
	} );
  });
//加载列表数据
function getTableData(){
	$.ajax({
		   type:'get',
		   url:common_list_url,
		   data:$("#"+searchFormId).serialize()+getCurrentPage(common_list_url+"?"+$("#"+searchFormId).serialize(),myPage),
		   dataType:'json',
		   success: function(myData){
			var data = baidu.template(dataListId+"-template",eval(myData));  
			$("#"+dataListId+"-body").html(data);
			  var option= {
					   ele:$("#"+dataListId+"-page")[0],
					   total:myData.total,
					   fn:getTableData,
					   url:common_list_url+"?"+$("#"+searchFormId).serialize()
				   }
				generatePages(option);
		   }
		});	
  }

//设置模态框隐藏事件 
$( '#my_modal_add' ).on( 'show.bs.modal' ,function(e){  
	$.ajax({
	    type:'get',
	    url:'${ctx}/sendPage/token?token=true',
	    dataType:'json',
	    success: function(myData){
	    	if(isShowLog)console.log(myData);
			 $('#formToken').val(myData);
	  	}
	});	
}); 
//清空数据
function cleanData(id){
	$('#'+id).find(".clean").val("");//按照样式清空；
}

function toAdd(){
	cleanData('submitFormData');//情况模态窗口内数据
	setValidate("#addForm");//定义add表单验证属性
	$(".datepicker").val("");
	$('#my_modal_add').modal('show');
}

//获取对象值
function loadObj(type,paramData){
	$.ajax({
	    type:'get',
	   	url:common_info_url+"?doCode=dymicSql",
	    data: paramData,
	    async:false,
	    dataType:"json",
	    success: function(myData){
	    	showData(type,myData);
	  	}
	});	
}

//删除信息（逻辑删除）
function doDele(paramData){
	$.ajax({
	    type:"get",
	    url:"${ctx}/info/delInfo",
	    data: paramData,
	    dataType:"json",
	    success: function(myData){
	    	var result = myData.flag;
	    	if(result=="T"){
	    		layer.alert("删除操作成功");
	    		refresh();
	    	}else{
	    		layer.alert(myData.msg);
	    	}
	  	}
	});	
}

/**
 * 表单数据提交
 * @param formId
 */
function add(formId){
	//校验规则-表单提交时触发
	var validate = $('#'+formId).data('bootstrapValidator').validate();
	if(!validate.isValid()){ //如果校验不通过就返回
	    return;  
	}
	
	var index_submit = layer.confirm('您确定要提交信息吗？', {btn: ['Yes','No'],closeBtn: 0,offset: '220px'}
	, function(){
		layer.close(index_submit);
		$.ajax({
		    type:"post",
		    url:"${ctx}/info/saveInfo",
		    data:$("#"+formId).serialize(),
		    dataType:"json",
		    success: function(myData){
		    	//console.log(myData);
		    	if(myData.flag=="T"){
		    		layer.alert("数据操作成功");
		    		if("addForm"==formId){
		    		$("#my_modal_add").modal("hide");
		    		}else{
		    		$("#my_modal_edit").modal("hide");
		    		}
		    	}else{
		    		layer.alert(myData.msg);
		    	}
		    	validate.resetForm();//提交成功后，删除校验方法
		    	refresh();
		  	}
		});	
	});
}

function startOrStop(sortId,type){
var url="${ctx}/info/publish";
var cmsg ="您确定要启用表单吗？";
if("stop"==type){
    cmsg = "您确定要停用表单？表单停用将删除表中所有数据";
    url="${ctx}/info/stop";
}
	var index_submit = layer.confirm(cmsg, {btn: ['Yes','No'],closeBtn: 0,offset: '220px'}
	, function(){
		layer.close(index_submit);
		$.ajax({
		    type:"get",
		    url:url,
		    data:{sortId:sortId},
		    dataType:"json",
		    success: function(myData){
		    	console.log(myData);
		    	if(myData.flag=="T"){
		    		layer.alert("操作成功");
		    	}else{
		    		layer.alert(myData.msg);
		    	}
		    	refresh();
		  	}
		});	
	});
}

//关闭win
function cannel(type){
	if(strUtil.isNull(type)){
		$('#my_modal_add').modal('hide');
	}else{
		$('#my_modal_'+type).modal('hide');
	}
}

function refresh(){
	getTableData();
}


function setToken(){
	$.ajax({
	    type:'get',
	    url:'${ctx}/sendPage/token?token=true',
	    dataType:'text',
	    success: function(myData){
	    	console.log(myData);
			 $('#formToken').val(myData);
	  	}
	});	
}
function createSql(){
	$.ajax({
	    type:'post',
	    url:'/common/coding/buildSql',
	    data:{databaseType:$("#databaseType").val()},
	    dataType:'json',
	    success: function(myData){
	    	console.log(myData);
	    	$('#my_modal_sql').modal('show');
			 $('#dataBase_sql').html(myData.msg);
	  	}
	});	
}


//自定义方法
//1.定义校验规则-定义
function setValidate(id){
	$(id).bootstrapValidator({
	    feedbackIcons: {
	        valid: 'glyphicon glyphicon-ok',
	        invalid: 'glyphicon glyphicon-remove',
	        validating: 'glyphicon glyphicon-refresh'
	    },/** 以下需要结合实际业务清空补充个表单元素的验证规则 **/
	    fields: {
	        "tablePrefix": {
	            validators: {
	                notEmpty: {
	                    message: '自定义属性不能为空！'
	                },
	                regexp:{
	                	regexp:/^[a-zA-Z]+$/,
	                	message:'表的英文前缀标识，只能填写字母！'
	                }
	            }
	        },    
	        "sortCode": {
	            validators: {
	                notEmpty: {
	                    message: '自定义属性不能为空！'
	                },
	                regexp:{
	                	regexp:/^[a-zA-Z][a-zA-Z_ ]+$/,
	                	message:'数据表的英文名，只能填写字母，多个单词使用下划线间隔！'
	                }
	            }
	        },
	        "sortName": {
	            validators: {
	                notEmpty: {
	                    message: '自定义属性不能为空！'
	                },
	               /* regexp: {
	                	regexp:/^[\u4e00-\u9fa5]*$/,
	                    message: '请输入数据表的中文名！'	
	                }*/
	            }
	        },
	        "objName": {
	            validators: {
	                notEmpty: {
	                    message: '自定义属性不能为空！'
	                },
	                regexp: {
	                	regexp:/^[a-zA-Z]+$/,
	                    message: '请填写英文数据表名-驼峰式！'	
	                }
	            }
	        },
	    }
	});
}
</script>   
    
  </div>
  <!-- /.content-wrapper -->
  <!-- foot start -->
  <%@include file="/common/plateform/foot.jsp" %>
  <!-- foot start -->
</div>  






</body>
	


</html>

